package com.eastshop.seller.adminaction;

import com.eastshop.seller.service.SellerService;
import com.eastshop.seller.vo.Seller;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
/**
 * 后台商家管理的Action类
 * @author admin
 *
 */
public class AdminSellerAction extends ActionSupport implements ModelDriven<Seller> {
	// 模型驱动使用的对象
	private Seller seller = new Seller();
	
	public Seller getModel() {
		return seller;
	}
	
	// 注入商家的Service
	private SellerService sellerService;

	public void setSellerService(SellerService sellerService) {
		this.sellerService = sellerService;
	}
	
	// 查找商家信息
	public String find(){
		seller = sellerService.find();
		ActionContext.getContext().getValueStack().set("seller", seller);
		return "find";
	}
	
	// 跳转到修改商家的信息的页面
	public String edit(){
		seller = sellerService.find();
		ActionContext.getContext().getValueStack().set("seller", seller);
		return "edit";
	}
	
	// 修改商家的信息
	public String editSubmit(){
		sellerService.update(seller);
		return "editSubmit";
	}
}
